﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Mongo.ViewModels
{
    using Core.Models;
    using MongoDB.Bson;

    public class UserViewModel
    {
        public string Id { get; set; }
        public string name { get; set; }
        public DateTime join_date { get; set; }
        public int focus { get; set; }

        public UserViewModel() { }

        public UserViewModel(User user)
        {
            CopyFrom(user);
        }

        public User CopyTo()
        {
            return new User
                   {
                       Id = new ObjectId(Id),
                       name = name,
                       join_date = join_date,
                       focus = focus
                   };
        }

        public void CopyFrom(User user)
        {
            Id = user.Id.ToString();
            name = user.name;
            join_date = user.join_date;
            focus = user.focus;
        }
    }
}